/*
* World.h
*
*  Created on: 2009/03/04
*      Author: Yongshik Cho
*/

#ifndef WORLD_H_
#define WORLD_H_

#include <map>
#include "core/Prerequisites.h"
#include "core/Vector2D.h"
#include "core/ISmartPtr.h"
#include "RenderObject.h"
#include "Box2D.h"
#include "sqplus/sqplus.h"
using namespace SqPlus;


class World : public ISmartPtr<World>
{
public:
	World(void);
	~World(void);

public:
	void tick(const uint32 elapsed);

	void addBody(RenderObject* obj);
	b2Body* getBody(RenderObject* obj);

public:
	inline const String& getName() const { return mName; }
	inline void setName(const String& s) { mName = s; }
	inline const Vector2D& getGravity() const { return mGravity; }
	void setGravity(const Vector2D& v);
	inline const Vector2D& getWind() const { return mWind; }
	void setWind(const Vector2D& v);

private:
	typedef map<RenderObject*, b2Body*> BodyType;

	String		mName;
	Vector2D	mGravity;
	Vector2D	mWind;
	b2World*	mWorld;

	BodyType	mBodies;
};

//must be declared here
DECLARE_INSTANCE_TYPE(World)

#endif /* WORLD_H_ */
